<div class="layui-fluid" id="VIEW-list-table" lay-title="产品列表">
    <div class="layui-row layui-col-space10">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">筛选数据</div>
                <div class="layui-card-body">
                    <form class="layui-form" lay-filter="lig-product-searchform">
                        <div class="layui-inline">
                            <label class="layui-form-label">名称</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" name="name" />
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">银行</label>
                            <div class="layui-input-inline">
                                <input type="text" class="layui-input" name="bankName" />
                            </div>
                        </div>
                        <div class="layui-inline">
                            <input type="button" class="layui-btn layui-btn-sm" 
                            lay-filter="lig-product-search" value="查询">
                            <input type="button" class="layui-btn layui-btn-sm layui-btn-primary" 
                            lay-filter="lig-product-reset" value="重置">
                        </div>
                    </form>
                </div>
            </div>
            <div class="layui-card">
                <div class="layui-card-body nepadmin-table-full">
                    <div class="layui-btn-container nepadmin-pad-t10 nepadmin-pad-l10">
                        <div class="layui-btn layui-btn-sm" lay-filter="lig-product-add">添加产品</div>
                        <div class="layui-btn layui-btn-sm layui-btn-primary" lay-filter="lig-product-remove">删除</div>
                    </div>
                    <table lay-filter="lig-product-table"></table>
                </div>
            </div>
        </div>
    </div>
</div>
<script type="text/html" id="tpl-row-toolBar">
    <a class="layui-btn layui-btn-primary layui-btn-xs lig-modify" lay-event="lig-modify" title="修改">修改</a>
    <a class="layui-btn layui-btn-primary layui-btn-xs lig-modify" lay-event="lig-product-rule" title="规则设置">规则设置</a>
    <!-- <a class="layui-btn layui-btn-primary layui-btn-xs lig-modify" lay-event="lig-product-area" title="适用区域">适用区域</a> -->
</script>
<script type="text/html" id="tpl-product-add">
    <form class="layui-form" style="padding: 20px 20px 0 0;" lay-filter="lig-saveForm">
        <div class="layui-form-item">
            <label class="layui-form-label">产品图标</label>
            <div class="layui-input-inline">
                <div class="layui-upload-list" style="margin:0">
                    <input type="hidden" name="logo" value=""/>
                    <img src='{{# conf.requestUrl + "/setting/file/output?fileUrl=1638423174914871298.jpeg" #}}' 
                    id="srcimgurl" 
                    class="layui-upload-img"
                    style="width:80px;height:80px;">
                </div>
            </div>
            <div class="layui-input-inline">
                <button type="button" class="layui-btn layui-btn-primary" id="editimg">修改图标</button>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">产品二维码</label>
            <div class="layui-input-inline">
                <div class="layui-upload-list" style="margin:0">
                    <input type="hidden" name="qr" value=""/>
                    <img src='' 
                    id="srcqr" 
                    class="layui-upload-img"
                    style="width:80px;height:80px;">
                </div>
            </div>
            <div class="layui-input-inline">
                <button type="button" class="layui-btn layui-btn-primary" id="editqr">修改二维码</button>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label ligui-form-item-required">产品名称</label>
            <div class="layui-input-block">
                <input type="text" name="name" autocomplete="off" class="layui-input" value='' lay-verify="required">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">银行</label>
            <div class="layui-input-block">
                <input type="text" name="bankName" autocomplete="off" class="layui-input" value=''>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">类型</label>
            <div class="layui-input-block">
                <select name="productType" lay-verify="required">
                    <option value="1">税</option>
                    <option value="2">票</option>
                    <option value="3">跨境电商</option>
                    <option value="4">个人经营性贷款</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">年化利息</label>
            <div class="layui-input-block">
                <input type="text" name="interestYear" autocomplete="off" class="layui-input" value=''>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">最高额度</label>
            <div class="layui-input-block">
                <input type="text" name="quota" autocomplete="off" class="layui-input" value=''>
            </div>
        </div>
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">工商注册</label>
            <div class="layui-input-inline" style="width: 100px;">
                <input type="text" name="registerDay" autocomplete="off" class="layui-input" value="0">
            </div>
            <div class="layui-form-mid layui-word-aux">个月</div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">法人变更</label>
            <div class="layui-input-inline" style="width: 100px;">
                <input type="text" name="legalPersonChange" autocomplete="off" class="layui-input" value="0">
            </div>
            <div class="layui-form-mid layui-word-aux">个月</div>
        </div> -->
        <div class="layui-form-item">
            <label class="layui-form-label">年龄范围</label>
            <div class="layui-input-inline" style="width: 100px;">
                <input type="text" name="legalPersonAgeStart" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid">至</div>
            <div class="layui-input-inline" style="width: 100px;">
                <input type="text" name="legalPersonAgeEnd" autocomplete="off" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">岁</div>
        </div>
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">法人持股</label>
            <div class="layui-input-block">
                <input type="text" name="legalPersonShare" autocomplete="off" class="layui-input" value=''>
            </div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">支持股东</label>
            <div class="layui-input-block">
                <input type="radio" name="ifShareholder" value="0" title="否" checked>
                <input type="radio" name="ifShareholder" value="1" title="是">
            </div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">纳税等级</label>
            <div class="layui-input-block">
                <input type="checkbox" name="taxLevelA" value="A" title="A" lay-skin="primary">
                <input type="checkbox" name="taxLevelB" value="B" title="B" lay-skin="primary"> 
                <input type="checkbox" name="taxLevelC" value="C" title="C" lay-skin="primary">
                <input type="checkbox" name="taxLevelD" value="D" title="D" lay-skin="primary">
                <input type="checkbox" name="taxLevelM" value="M" title="M" lay-skin="primary">
            </div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">纳税状态是否正常</label>
            <div class="layui-input-block">
                <input type="radio" name="ifTaxStatus" value="0" title="否">
                <input type="radio" name="ifTaxStatus" value="1" title="是">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">企业历史是否有欠税记录</label>
            <div class="layui-input-block">
                <input type="radio" name="ifTaxArrearsHistory" value="0" title="否">
                <input type="radio" name="ifTaxArrearsHistory" value="1" title="是">
            </div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">企业纳税时长</label>
            <div class="layui-input-inline">
                <input type="text" name="taxDuration" autocomplete="off" 
                class="layui-input" value=''
                onkeyup="value=value.replace(/[^\d]/g,'')">
            </div>
            <div class="layui-form-mid layui-word-aux">个月</div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">企业近1年应税销售收入</label>
            <div class="layui-input-inline">
                <input type="text" name="taxSalesYear" autocomplete="off" 
                class="layui-input" value=''
                onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')">
            </div>
            <div class="layui-form-mid layui-word-aux">万</div>
        </div> -->
        
        <div class="layui-form-item">
            <label class="layui-form-label">开票时长</label>
            <div class="layui-input-inline">
                <input type="text" name="invoiceDuration" autocomplete="off" 
                class="layui-input" value=''
                onkeyup="value=value.replace(/[^\d]/g,'')">
            </div>
            <div class="layui-form-mid layui-word-aux">个月</div>
        </div>
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">近1年开票月数</label>
            <div class="layui-input-inline">
                <input type="text" name="invoiceCountYear" autocomplete="off" 
                class="layui-input" value=''
                onkeyup="value=value.replace(/[^\d]/g,'')">
            </div>
            <div class="layui-form-mid layui-word-aux">个月</div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">近1年开票额度</label>
            <div class="layui-input-inline" style="width: 100px;">
                <input type="text" name="invoiceYearStart" placeholder="￥" autocomplete="off" class="layui-input"
                    onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')">
            </div>
            <div class="layui-form-mid">-</div>
            <div class="layui-input-inline" style="width: 100px;">
                <input type="text" name="invoiceYearEnd" placeholder="￥" autocomplete="off" class="layui-input"
                    onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')">
            </div>
            <div class="layui-form-mid layui-word-aux">万</div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">还款方式</label>
            <div class="layui-input-block">
                <input type="text" name="paymentWay" autocomplete="off" class="layui-input" value=''>
            </div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">放款时效</label>
            <div class="layui-input-block">
                <input type="text" name="loadWait" autocomplete="off" class="layui-input" value=''>
            </div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">是否电核</label>
            <div class="layui-input-block">
                <input type="radio" name="ifCheckingTel" value="0" title="否" checked>
                <input type="radio" name="ifCheckingTel" value="1" title="是">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">电核开头号码</label>
            <div class="layui-input-block">
                <input type="text" name="checkingTelStart" autocomplete="off" class="layui-input" value=''>
            </div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">放款账户</label>
            <div class="layui-input-block">
                <input type="text" name="loadAccount" autocomplete="off" class="layui-input" value=''>
            </div>
        </div> -->
        <div class="layui-form-item">
            <label class="layui-form-label">周末是否审批</label>
            <div class="layui-input-block">
                <input type="radio" name="weekendChecking" value="0" title="否" checked>
                <input type="radio" name="weekendChecking" value="1" title="是">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">提前还款手续费</label>
            <div class="layui-input-block">
                <input type="text" name="paymentPreFee" autocomplete="off" class="layui-input" value=''>
            </div>
        </div>
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">个体工商户</label>
            <div class="layui-input-block">
                <input type="radio" name="ifSelfEmployed" value="0" title="不支持" checked>
                <input type="radio" name="ifSelfEmployed" value="1" title="支持">
            </div>
        </div> -->
        <div class="layui-form-item">
            <label class="layui-form-label">重要通知</label>
            <div class="layui-input-block">
                <textarea name="notice" class="layui-textarea" style="height:100px;line-height:20px;"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">还款期限</label>
            <div class="layui-input-block">
                <input type="text" name="paymentTimeLimit" autocomplete="off" class="layui-input" value=''>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">还款日</label>
            <div class="layui-input-block">
                <input type="text" name="paymentDue" autocomplete="off" class="layui-input" value=''>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">进件方式</label>
            <div class="layui-input-block">
                <input type="text" name="entryWay" autocomplete="off" class="layui-input" value=''>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">准入要求</label>
            <div class="layui-input-block">
                <textarea name="accessRequirement" class="layui-textarea" style="height:150px;line-height:20px;"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">准入区域</label>
            <div class="layui-input-block">
                <textarea name="areaRemark" class="layui-textarea" style="height:150px;line-height:20px;"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">禁入行业</label>
            <div class="layui-input-block">
                <input type="text" name="forbidTrade" autocomplete="off" class="layui-input" value=''>
            </div>
        </div>
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">征信查询</label>
            <div class="layui-input-block">
                <input type="text" name="creditChecking" autocomplete="off" class="layui-input" value=''>
            </div>
        </div> -->
        <div class="layui-form-item">
            <label class="layui-form-label">操作流程</label>
            <div class="layui-input-block">
                <textarea name="applyAction" class="layui-textarea" style="height:100px;line-height:20px;"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">申贷流程</label>
            <div class="layui-input-block">
                <textarea name="applyProcess" class="layui-textarea" style="height:100px;line-height:20px;"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">申请材料</label>
            <div class="layui-input-block">
                <textarea name="applyFile" class="layui-textarea" style="height:100px;line-height:20px;"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">注意事项</label>
            <div class="layui-input-block">
                <textarea name="attention" class="layui-textarea" style="height:100px;line-height:20px;"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">常见问题</label>
            <div class="layui-input-block">
                <textarea name="faq" class="layui-textarea" style="height:100px;line-height:20px;"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <textarea name="remark" class="layui-textarea" style="height:100px;line-height:20px;"></textarea>
            </div>
        </div>
    </form>
</script>
<script type="text/html" id="tpl-product-modify">
    <form class="layui-form" style="padding: 20px 20px 0 0;" lay-filter="lig-saveForm">
        <input type="hidden" name="productId" value='{{d.productId}}'>
        <div class="layui-form-item">
            <label class="layui-form-label">产品图标</label>
            <div class="layui-input-inline">
                <div class="layui-upload-list" style="margin:0">
                    <input type="hidden" name="logo" value='{{d.logo}}'/>
                    <img src="{{d.logo}}" 
                    id="srcimgurl" 
                    class="layui-upload-img"
                    style="width:80px;height:80px;">
                </div>
            </div>
            <div class="layui-input-inline">
                <button type="button" class="layui-btn layui-btn-primary" id="editimg">修改图标</button>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">产品二维码</label>
            <div class="layui-input-inline">
                <div class="layui-upload-list" style="margin:0">
                    <input type="hidden" name="qr" value="{{d.qrFileName}}"/>
                    <img src='{{d.qr}}' 
                    id="srcqr" 
                    class="layui-upload-img"
                    style="width:80px;height:80px;">
                </div>
            </div>
            <div class="layui-input-inline">
                <button type="button" class="layui-btn layui-btn-primary" id="editqr">修改二维码</button>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label ligui-form-item-required">排序号</label>
            <div class="layui-input-block">
                <input type="number" name="serial" autocomplete="off" class="layui-input" value='{{d.serial}}'>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label ligui-form-item-required">产品名称</label>
            <div class="layui-input-block">
                <input type="text" name="name" autocomplete="off" class="layui-input" value='{{d.name}}' lay-verify="required">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">银行</label>
            <div class="layui-input-block">
                <input type="text" name="bankName" autocomplete="off" class="layui-input" value='{{d.bankName}}'>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">类型</label>
            <div class="layui-input-block">
                <select name="productType" lay-verify="required">
                    <option value="1" {{# if (d.productType == 1) { }} selected {{# } }}>税</option>
                    <option value="2" {{# if (d.productType == 2) { }} selected {{# } }}>票</option>
                    <option value="3" {{# if (d.productType == 3) { }} selected {{# } }}>跨境电商</option>
                    <option value="4" {{# if (d.productType == 4) { }} selected {{# } }}>个人经营性贷款</option>
                </select>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">年化利息</label>
            <div class="layui-input-block">
                <input type="text" name="interestYear" autocomplete="off" class="layui-input" value='{{d.interestYear}}'>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">最高额度</label>
            <div class="layui-input-block">
                <input type="text" name="quota" autocomplete="off" class="layui-input" value='{{d.quota}}'>
            </div>
        </div>
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">工商注册</label>
            <div class="layui-input-inline" style="width: 100px;">
                <input type="text" name="registerDay" autocomplete="off" class="layui-input" 
                value="{{d.registerDay == null ? 0 : d.registerDay}}">
            </div>
            <div class="layui-form-mid layui-word-aux">个月</div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">法人变更</label>
            <div class="layui-input-inline" style="width: 100px;">
                <input type="text" name="legalPersonChange" autocomplete="off" class="layui-input" 
                value="{{d.legalPersonChange == null ? 0 : d.legalPersonChange}}">
            </div>
            <div class="layui-form-mid layui-word-aux">个月</div>
        </div> -->
        <div class="layui-form-item">
            <label class="layui-form-label">年龄范围</label>
            <div class="layui-input-inline" style="width: 100px;">
                <input type="text" name="legalPersonAgeStart" autocomplete="off" class="layui-input" 
                value='{{d.legalPersonAgeStart == null ? 0 : d.legalPersonAgeStart}}'>
            </div>
            <div class="layui-form-mid">至</div>
            <div class="layui-input-inline" style="width: 100px;">
                <input type="text" name="legalPersonAgeEnd" autocomplete="off" class="layui-input" 
                value='{{d.legalPersonAgeEnd == null ? 0 : d.legalPersonAgeEnd}}'>
            </div>
            <div class="layui-form-mid layui-word-aux">岁</div>
        </div>
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">法人持股</label>
            <div class="layui-input-block">
                <input type="text" name="legalPersonShare" autocomplete="off" class="layui-input" value='{{d.legalPersonShare}}'>
            </div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">支持股东</label>
            <div class="layui-input-block">
                <input type="radio" name="ifShareholder" value="0" title="否" {{# if (d.ifShareholder == 0) { }} checked {{# } }}>
                <input type="radio" name="ifShareholder" value="1" title="是" {{# if (d.ifShareholder == 1) { }} checked {{# } }}>
            </div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">纳税等级</label>
            <div class="layui-input-block">
                <input type="hidden" name="taxLevel" value='{{d.taxLevel}}'>
                <input type="checkbox" name="taxLevelA" value="A" title="A" lay-skin="primary" {{# if (d.taxLevel.indexOf('A') > -1) { }} checked {{# } }}>
                <input type="checkbox" name="taxLevelB" value="B" title="B" lay-skin="primary" {{# if (d.taxLevel.indexOf('B') > -1) { }} checked {{# } }}> 
                <input type="checkbox" name="taxLevelC" value="C" title="C" lay-skin="primary" {{# if (d.taxLevel.indexOf('C') > -1) { }} checked {{# } }}>
                <input type="checkbox" name="taxLevelD" value="D" title="D" lay-skin="primary" {{# if (d.taxLevel.indexOf('D') > -1) { }} checked {{# } }}>
                <input type="checkbox" name="taxLevelM" value="M" title="M" lay-skin="primary" {{# if (d.taxLevel.indexOf('M') > -1) { }} checked {{# } }}>
            </div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">纳税状态是否正常</label>
            <div class="layui-input-block">
                <input type="radio" name="ifTaxStatus" value="0" title="否" {{# if (d.ifTaxStatus == 0) { }} checked {{# } }}>
                <input type="radio" name="ifTaxStatus" value="1" title="是" {{# if (d.ifTaxStatus == 1) { }} checked {{# } }}>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">企业历史是否有欠税记录</label>
            <div class="layui-input-block">
                <input type="radio" name="ifTaxArrearsHistory" value="0" title="否" {{# if (d.ifTaxArrearsHistory == 0) { }} checked {{# } }}>
                <input type="radio" name="ifTaxArrearsHistory" value="1" title="是" {{# if (d.ifTaxArrearsHistory == 1) { }} checked {{# } }}>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">企业纳税时长</label>
            <div class="layui-input-inline">
                <input type="text" name="taxDuration" autocomplete="off" 
                class="layui-input" value='{{d.taxDuration == null ? "" : d.taxDuration}}'
                onkeyup="value=value.replace(/[^\d]/g,'')">
            </div>
            <div class="layui-form-mid layui-word-aux">个月</div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">企业近1年应税销售收入</label>
            <div class="layui-input-inline">
                <input type="text" name="taxSalesYear" autocomplete="off" 
                class="layui-input" value='{{d.taxSalesYear == null ? "" : d.taxSalesYear}}'
                onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')">
            </div>
            <div class="layui-form-mid layui-word-aux">万</div>
        </div> -->
        
        <div class="layui-form-item">
            <label class="layui-form-label">开票时长</label>
            <div class="layui-input-inline">
                <input type="text" name="invoiceDuration" autocomplete="off" 
                class="layui-input" value='{{d.invoiceDuration == null ? "" : d.invoiceDuration}}'
                onkeyup="value=value.replace(/[^\d]/g,'')">
            </div>
            <div class="layui-form-mid layui-word-aux">个月</div>
        </div>
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">近1年开票月数</label>
            <div class="layui-input-inline">
                <input type="text" name="invoiceCountYear" autocomplete="off" 
                class="layui-input" value='{{d.invoiceCountYear == null ? "" : d.invoiceCountYear}}'
                onkeyup="value=value.replace(/[^\d]/g,'')">
            </div>
            <div class="layui-form-mid layui-word-aux">个月</div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">近1年开票额度</label>
            <div class="layui-input-inline" style="width: 100px;">
                <input type="text" name="invoiceYearStart" placeholder="￥" autocomplete="off" class="layui-input"
                    value='{{d.invoiceYearStart == null ? "" : d.invoiceYearStart}}' 
                    onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')">
            </div>
            <div class="layui-form-mid">-</div>
            <div class="layui-input-inline" style="width: 100px;">
                <input type="text" name="invoiceYearEnd" placeholder="￥" autocomplete="off" class="layui-input"
                    value='{{d.invoiceYearEnd == null ? "" : d.invoiceYearEnd}}' 
                    onkeyup="value=value.replace(/^\D*(\d*(?:\.\d{0,2})?).*$/g, '$1')">
            </div>
            <div class="layui-form-mid layui-word-aux">万</div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">还款方式</label>
            <div class="layui-input-block">
                <input type="text" name="paymentWay" autocomplete="off" class="layui-input" value='{{d.paymentWay}}'>
            </div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">放款时效</label>
            <div class="layui-input-block">
                <input type="text" name="loadWait" autocomplete="off" class="layui-input" value='{{d.loadWait}}'>
            </div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">是否电核</label>
            <div class="layui-input-block">
                <input type="radio" name="ifCheckingTel" value="0" title="否"  {{# if (d.ifCheckingTel == 0) { }} checked {{# } }}>
                <input type="radio" name="ifCheckingTel" value="1" title="是"  {{# if (d.ifCheckingTel == 1) { }} checked {{# } }}>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">电核开头号码</label>
            <div class="layui-input-block">
                <input type="text" name="checkingTelStart" autocomplete="off" class="layui-input" value='{{d.checkingTelStart}}'>
            </div>
        </div> -->
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">放款账户</label>
            <div class="layui-input-block">
                <input type="text" name="loadAccount" autocomplete="off" class="layui-input" value='{{d.loadAccount}}'>
            </div>
        </div> -->
        <div class="layui-form-item">
            <label class="layui-form-label">周末是否审批</label>
            <div class="layui-input-block">
                <input type="radio" name="weekendChecking" value="0" title="否" {{# if (d.weekendChecking == 0) { }} checked {{# } }}>
                <input type="radio" name="weekendChecking" value="1" title="是" {{# if (d.weekendChecking == 1) { }} checked {{# } }}>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">提前还款手续费</label>
            <div class="layui-input-block">
                <input type="text" name="paymentPreFee" autocomplete="off" class="layui-input" value='{{d.paymentPreFee}}'>
            </div>
        </div>
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">个体工商户</label>
            <div class="layui-input-block">
                <input type="radio" name="ifSelfEmployed" value="0" title="不支持" {{# if (d.ifSelfEmployed == 0) { }} checked {{# } }}>
                <input type="radio" name="ifSelfEmployed" value="1" title="支持" {{# if (d.ifSelfEmployed == 1) { }} checked {{# } }}>
            </div>
        </div> -->
        <div class="layui-form-item">
            <label class="layui-form-label">重要通知</label>
            <div class="layui-input-block">
                <textarea name="notice" class="layui-textarea" style="height:100px;line-height:20px;">{{d.notice}}</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">还款期限</label>
            <div class="layui-input-block">
                <input type="text" name="paymentTimeLimit" autocomplete="off" class="layui-input" value='{{d.paymentTimeLimit}}'>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">还款日</label>
            <div class="layui-input-block">
                <input type="text" name="paymentDue" autocomplete="off" class="layui-input" value='{{d.paymentDue}}'>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">进件方式</label>
            <div class="layui-input-block">
                <input type="text" name="entryWay" autocomplete="off" class="layui-input" value='{{d.entryWay}}'>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">准入要求</label>
            <div class="layui-input-block">
                <textarea name="accessRequirement" class="layui-textarea" style="height:150px;line-height:20px;">{{d.accessRequirement}}</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">准入区域</label>
            <div class="layui-input-block">
                <textarea name="areaRemark" class="layui-textarea" style="height:150px;line-height:20px;">{{d.areaRemark}}</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">禁入行业</label>
            <div class="layui-input-block">
                <input type="text" name="forbidTrade" autocomplete="off" class="layui-input" value='{{d.forbidTrade}}'>
            </div>
        </div>
        <!-- <div class="layui-form-item">
            <label class="layui-form-label">征信查询</label>
            <div class="layui-input-block">
                <input type="text" name="creditChecking" autocomplete="off" class="layui-input" value='{{d.creditChecking}}'>
            </div>
        </div> -->
        <div class="layui-form-item">
            <label class="layui-form-label">操作流程</label>
            <div class="layui-input-block">
                <textarea name="applyAction" class="layui-textarea" style="height:100px;line-height:20px;">{{d.applyAction}}</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">申贷流程</label>
            <div class="layui-input-block">
                <textarea name="applyProcess" class="layui-textarea" style="height:100px;line-height:20px;">{{d.applyProcess}}</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">申请材料</label>
            <div class="layui-input-block">
                <textarea name="applyFile" class="layui-textarea" style="height:100px;line-height:20px;">{{d.applyFile}}</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">注意事项</label>
            <div class="layui-input-block">
                <textarea name="attention" class="layui-textarea" style="height:100px;line-height:20px;">{{d.attention}}</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">常见问题</label>
            <div class="layui-input-block">
                <textarea name="faq" class="layui-textarea" style="height:100px;line-height:20px;">{{d.faq}}</textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <textarea name="remark" class="layui-textarea" style="height:100px;line-height:20px;">{{d.remark}}</textarea>
            </div>
        </div>
    </form>
</script>
<script type="text/html" id="tpl-product-rule">
    <form class="layui-form" lay-filter="lig-saveForm" style="padding: 10px 20px 0 20px;">
        <input type="hidden" name="productId"/>
        <div lay-filter="tree-product-rule"></div>
    </form>
</script>
<script type="text/html" id="tpl-product-area">
    <form class="layui-form" lay-filter="lig-saveForm" style="padding: 10px 20px 0 20px;">
        <input type="hidden" name="productId"/>
        <div lay-filter="tree-product-area"></div>
    </form>
</script>
<script>
    layui.use(['admin', 'table', 'form', 'dropdown', 'laytpl', 'jquery','lig', 'upload', 'conf', 'eleTree'], 
        function (admin, table, form, dropdown, laytpl, $, lig, upload, conf, eleTree) {
        form.render();

        var productId;

        // 实例代码，加载字典项
        lig.loadSelectDict('sku_splb', '[lay-filter="lig-product-searchform"] select[name="splb"]');

        var productTable = lig.table({
            elem: '[lay-filter="lig-product-table"]',
            url: 'bu/product/page',
            autoSort: false,
            cols: [[
                { title: '', type: 'checkbox', fixed: true, width: 50 },
                { title: '操作', toolbar: '#tpl-row-toolBar', align: 'left', width: '15%'},
                { title: '产品名称', field: 'name', sort: true, width: '15%' },
                { title: '银行', field: 'bankName', width: '30%' },
                { title: '年化利息', field: 'interestYear', width: '15%' },
                { title: '最高额度', field: 'quota', width: '10%' },
                { title: '排序号', field: 'serial',align:'center', width: '10%' },

            ]]
        },{
            mode:'dialog',
            entity: 'product',
            primaryField: 'id',
            area: ['60%', '80%'],

            addContent: $('#tpl-product-add').html(),
            addUrl: 'bu/product/add',
            addTitle: '添加产品',
            onAddOpened: function() {
                var uploadInst = upload.render({
                    elem: '#editimg' //绑定元素
                    ,url: conf.requestUrl + '/setting/file/upload' //上传接口
                    ,done: function(res){
                      //上传完毕回调
                      $('#srcimgurl').attr('src', conf.requestUrl + '/setting/file/output?fileUrl=' + res.data[0].fileUrl);
                      $('[lay-filter="lig-saveForm"]').find('input[name="logo"]').val(res.data[0].fileUrl);
                    }
                    ,error: function(){
                      //请求异常回调
                    }
                });
                $('#srcimgurl').attr('src', conf.requestUrl + '/setting/file/output?fileUrl=1638423174914871298.jpeg');
                $('[lay-filter="lig-saveForm"]').find('input[name="logo"]').val('1638423174914871298.jpeg');

                var uploadInst = upload.render({
                    elem: '#editqr' //绑定元素
                    ,url: conf.requestUrl + '/setting/file/upload' //上传接口
                    ,done: function(res){
                      //上传完毕回调
                      $('#srcqr').attr('src', conf.requestUrl + '/setting/file/output?fileUrl=' + res.data[0].fileUrl);
                      $('[lay-filter="lig-saveForm"]').find('input[name="qr"]').val(res.data[0].fileUrl);
                    }
                    ,error: function(){
                      //请求异常回调
                    }
                });
                //$('#srcimgurl').attr('src', conf.requestUrl + '/setting/file/output?fileUrl=1638423174914871298.jpeg');
                //$('[lay-filter="lig-saveForm"]').find('input[name="logo"]').val('1638423174914871298.jpeg');
            },

            modifyContent: $('#tpl-product-modify').html(),
            modifyUrl: 'bu/product/modify',
            modifyTitle: '修改产品',
            onModifyOpened: function() {
                var uploadInst = upload.render({
                    elem: '#editimg' //绑定元素
                    ,url: conf.requestUrl + '/setting/file/upload' //上传接口
                    ,done: function(res){
                      //上传完毕回调
                      $('#srcimgurl').attr('src', conf.requestUrl + '/setting/file/output?fileUrl=' + res.data[0].fileUrl);
                      $('[lay-filter="lig-saveForm"]').find('input[name="logo"]').val(res.data[0].fileUrl);
                    }
                    ,error: function(){
                      //请求异常回调
                    }
                });

                var logo = $('[lay-filter="lig-saveForm"]').find('input[name="logo"]').val();
                $('#srcimgurl').attr('src', conf.requestUrl + '/setting/file/output?fileUrl=' + logo);


                var uploadInst = upload.render({
                    elem: '#editqr' //绑定元素
                    ,url: conf.requestUrl + '/setting/file/upload' //上传接口
                    ,done: function(res){
                      //上传完毕回调
                      $('#srcqr').attr('src', conf.requestUrl + '/setting/file/output?fileUrl=' + res.data[0].fileUrl);
                      $('[lay-filter="lig-saveForm"]').find('input[name="qr"]').val(res.data[0].fileUrl);
                    }
                    ,error: function(){
                      //请求异常回调
                    }
                });
                //var qr = $('[lay-filter="lig-saveForm"]').find('input[name="qr"]').val();
                // $('#srcqr').attr('src', conf.requestUrl + '/setting/file/output?fileUrl=' + $('[lay-filter="lig-saveForm"]').find('input[name="qr"]').val());
                // $('#srcqr').attr('src', conf.requestUrl + '/setting/file/output?fileUrl=' + res.data[0].fileUrl);

                // $('#srcqr').attr('src', );
            },

            removeUrl: 'bu/product/remove',
            getUrl: 'bu/product/{id}',

            onSave: function(data) {
                var taxLevel = '';
                if (typeof data.taxLevelA != 'undefined') {
                    taxLevel += ',' + data.taxLevelA;
                }
                if (typeof data.taxLevelB != 'undefined') {
                    taxLevel += ',' + data.taxLevelB;
                }
                if (typeof data.taxLevelC != 'undefined') {
                    taxLevel += ',' + data.taxLevelC;
                }
                if (typeof data.taxLevelD != 'undefined') {
                    taxLevel += ',' + data.taxLevelD;
                }
                if (taxLevel != '') {
                    taxLevel = taxLevel.substring(1);
                }
                data.taxLevel = taxLevel;

                return data;
            },
            onTool: function (obj) {
                productId = obj.data.id;

                var productSaveLoadIdx;
                if (obj.event == 'lig-product-rule') {
                    lig.dialog({
                        content: $('#tpl-product-rule').html(),
                        title: '设置规则',
                        area: ['40%', '90%'],
                        saveUrl: 'bu/product/rule/modify',
                        onSave: function(data) {
                            productSaveLoadIdx = layer.load(0, {shade: 0.3});

                            data.productId = productId;
                            var _nodes = _eleTree.getChecked(false, true);
                            var _ids = '';
                            $.each(_nodes, function (i, it) {
                                _ids += it.id + ',';
                            });
                            data.ruleIdList = _ids.substring(0, _ids.length - 1);
                            return data;
                        },
                        onOpened: function () {
                            // var _saveForm = $('[lay-filter="lig-saveForm"]'), _roleId = data.item.roleId;;
                            // _saveForm.find('input[name="roleId"]').val(_roleId);
                            loadProductRuleTree(productId);
                        },
                        onCompleted: function () {
                            //requestData();
                            layer.close(productSaveLoadIdx);
                        }
                    });
                } else if (obj.event == 'lig-product-area') {
                    lig.dialog({
                        content: $('#tpl-product-area').html(),
                        title: '适用区域',
                        area: ['40%', '90%'],
                        saveUrl: 'bu/product/modify',
                        onSave: function(data) {
                            data.productId = productId;
                            var _nodes = _eleTree.getChecked(false, true);
                            var areaSelected = [];
                            $.each(_nodes, function (i, it) {
                                var parentId = getAreaParentId(it.id)
                                if (parentId) {
                                    var area = {};
                                    area.cityId = it.id;
                                    area.provinceId = parentId;
                                    areaSelected.push(area);
                                }
                            });
                            data.areaList = JSON.stringify(areaSelected);
                            return data;
                        },
                        onOpened: function () {
                            // var _saveForm = $('[lay-filter="lig-saveForm"]'), _roleId = data.item.roleId;;
                            // _saveForm.find('input[name="roleId"]').val(_roleId);
                            loadProductAreaTree(productId);
                        },
                        onCompleted: function () {
                            //requestData();
                        }
                    });
                }
            }
        });

        table.on('sort(lig-product-table)', function(obj){
            var orderBy = '';
            if (obj.type != null) {
                orderBy = obj.field + ' ' + obj.type;
            }
            productTable.reload({
                initSort: obj, // 记录初始排序，如果不设的话，将无法标记表头的排序状态。
                where: { // 请求参数（注意：这里面的参数可任意定义，并非下面固定的格式）
                  "orderBy": orderBy
                }
            });
        });


        var _eleTree;
        function loadProductRuleTree(productId) {
            lig.ajaxget({
                url: 'bu/product/rule/tree-selected/' + productId,
                success: function (res) {
                    if (!res.data) {
                        return;
                    }

                    _eleTree = eleTree.render({
                        elem: '[lay-filter="tree-product-rule"]',
                        highlightCurrent: true,
                        showLine: true,
                        defaultExpandAll: true,
                        defaultCheckedKeys: res.data.selectedIdList ? res.data.selectedIdList : [],
                        showCheckbox: true,
                        checkStrictly: true,
                        data: res.data.nodeList ? res.data.nodeList[0].children : [],
                        request: {
                            name: "name"
                        }
                    });

                    eleTree.on("nodeChecked(tree-product-rule)",function(d) {
                        if (d.isChecked) {
                            _eleTree.setChecked([d.data.currentData.id]);
                            checkedParent(d.node);
                            checkedChildren(d.data.currentData);
                        } else {
                            unCheckedChildren(d.data.currentData);
                        }
                    })
                }
            });
        }

        var allArea;
        function loadProductAreaTree(productId) {
            lig.ajaxget({
                url: 'bu/product/area/tree-selected/' + productId,
                success: function (res) {
                    if (!res.data) {
                        return;
                    }

                    allArea = res.data.nodeList[0].children;

                    _eleTree = eleTree.render({
                        elem: '[lay-filter="tree-product-area"]',
                        highlightCurrent: true,
                        showLine: true,
                        defaultExpandAll: true,
                        defaultCheckedKeys: res.data.selectedIdList ? res.data.selectedIdList : [],
                        showCheckbox: true,
                        checkStrictly: true,
                        data: res.data.nodeList ? res.data.nodeList[0].children : [],
                        request: {
                            name: "name"
                        }
                    });

                    eleTree.on("nodeChecked(tree-product-area)",function(d) {
                        if (d.isChecked) {
                            _eleTree.setChecked([d.data.currentData.id]);
                            checkedParent(d.node);
                            checkedChildren(d.data.currentData);
                        } else {
                            unCheckedChildren(d.data.currentData);
                        }
                    })
                }
            });
        }

        function checkedParent(node) {
            var parentNode = node.parent().parent();
            if (parentNode.hasClass('eleTree-node')) {
                _eleTree.setChecked([parentNode.attr('data-id')]);
                checkedParent(parentNode);
            }
        }

        function checkedChildren(data) {
            if (data.children) {
                $.each(data.children, function(i, it) {
                    _eleTree.setChecked([it.id]);
                    checkedChildren(it);
                });
            }
        }

        function unCheckedChildren(data) {
            if (data.children) {
                $.each(data.children, function(i, it) {
                    _eleTree.unCheckArrNodes([it.id]);
                    unCheckedChildren(it);
                });
            }
        }

        function getAreaParentId(id) {
            var parentId;
            $.each(allArea, function(i, it) {
                if (it.children && it.children.length > 0) {
                    $.each(it.children, function(j, th) {
                        if (id == th.id) {
                            parentId = th.parentId;
                            return false;
                        }
                    });
                    if (parentId) {
                        return false;
                    }
                }
            });
            return parentId;
        }

    })
</script>